<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=cfc('core')->checklogin('jy_qqdian/sharer.index/','',true);
	$return['show_setmobile']=cfc('core')->check_setmobile(1);
	$return['show_setmember']=cfc('core')->check_setmember(1);
	$member=model('core/member')->basic($_SESSION['uid'],array('credit1','credit2','credit3','credit4','credit5','credit6','mobile','avatar','nickname','username'));
	$user=pdo_get('jy_qqdian_sharer',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$user['bind_time']=date('Y/m/d',$user['bind_time']);
	$user['credit2']=$member['credit2'];
	$member['mid']=$_SESSION['uid'];
	$member['nickname']=$member['nickname']?:$member['mobile'];
	$return['member']=$member;
	$return['user']=$user;
	$return['share_scene']=$this->share_scene;
	$return['item']=array();
	exi($return);
}
if($_RQ['op']=='getewm'){
	$return['sharerewm']=$this->model('sharer')->sharerewm();
	exi($return);
}
//修改用户信息
if($_RQ['op']=='set'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array(
			'nickname'=>$postdata['nickname'],
			'avatar'=>$postdata['avatar'],
			'mobile'=>$postdata['mobile'],
		);
		$user_id=pdo_getcolumn('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'id');		
		if($user_id){
			pdo_update('core_members',$data,array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
			exi('修改成功','','jy_qqdian/sharer.index/');		 
		}else{
			$data['uniacid']=$_SESSION['uniacid'];
			$data['createtime']=TIMESTAMP;
			pdo_insert('core_members',$data);
		}
	}
	$member=pdo_get('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$return['item']=$member;
	exi($return);
}
